<script type="text/javascript">
    function proccessForm1(string){
        var getData1 = $.parseJSON(string);
        if(getData1.errors3 == true){
            alert("Bạn có thể đăng nhập lại với mật khẩu mới!");
        }else{
            if(getData1.er_email || getData1.er_email == ""){
                $("#er_email").html(getData1.er_email);
            }
            if(getData1.er_answers || getData1.er_answers == ""){
                $("#er_answers").html(getData1.er_answers);
            }
            if(getData1.er_pass || getData1.er_pass == ""){
                $("#er_password").html(getData1.er_pass);
            }
            if(getData1.er_repass || getData1.er_repass == ""){
                $("#er_repassword").html(getData1.er_repass);
            }
        }
    }

    $(document).ready(function(){
        $('#formQMK').submit(function(eve){
            eve.preventDefault();
            $.ajax({
                url: '<?= base_url(); ?>user/xl_quen_mk',
                type: 'POST',
                data: $('#formQMK').serialize(),
                success: function(string){
                    proccessForm1(string);
                },
                error: function(){
                    alert('Co loi xay ra');
                } 
            })
        });
    });
       
</script>
<div id="dangky">
    <form id="formQMK" name="formQMK" method="post" action="<?= base_url(); ?>user/xl_quen_mk">
        <fieldset id="main">
            <legend>Lấy lại mật khẩu</legend>
            <div id="InforAcc">
                <h2>Bạn quên mật khẩu tài khoản? </h2>
                <fieldset>
                    <label for="email">Email: </label>
                    <input type="text" name="email" id="email"/><span id="er_email" class="error"></span>
                </fieldset>                
                <fieldset>
                    <label for="aswers">Câu trả lời bí mật: </label>
                    <input type="text" name="answers" id="answers" name="answers"/><span id="er_answers" class="error"><?= form_error("email");?></span>
                </fieldset>
            </div>
            <div id="InforAcc">
                <h2>Nhập mật khẩu mới</h2>
                <fieldset>
                    <label for="password">Mật khẩu: </label>
                    <input type="password" name="password" id="password"/><span id="er_password" class="error"></span>
                </fieldset>
                <fieldset>
                    <label for="Repassword">Nhập lại mật khẩu: </label>
                    <input type="password" name="repassword" id="repassword"/><span id="er_repassword" class="error"></span>
                </fieldset>
            </div>
            <fieldset id="btn">
                <input type="submit" id="btnsubmit" value="gửi"/>
                <input type="reset" id="btnreset" value="xóa"/>
            </fieldset>
        </fieldset>
    </form>
</div>